<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div id="stageBrowse_div">

<div class="sale-view item-detail w954" v-for="(row,index) in levelData">

	<p style="color: red;font-size: 20px;">{{row.projectName}}</p>
	<div class="content-box margin-bottom-20" >
		<h3 class="detail-header border-all border-bottom-none">销售指标信息</h3>
		<table class="detail-table">
			<tr class="bg-gray">
				<th class="column1">月份</th>
				<th class="column2">计划销售额</th>
				<th class="column3">汇总实际销售额</th>
				<th class="column4">差额</th>
				<th class="column5">偏差原因</th>
				<th class="column6">操作</th>
			</tr>
			<tr v-for="srpSale in row.saleReturnList">
				<td class="column1">{{srpSale.saleMonth}}月</td>
                <td class="column2 table-number">{{srpSale.salePlan}}</td>
                <td class="column3 table-number">{{srpSale.saleActual}}</td>
                <td class="column4 table-number">{{srpSale.saleDiff}}</td>
                <td class="column5">{{srpSale.saleDiffReason}}</td>
				<td class="column6">
				  <a href="#" v-on:click="dynamiSalesInfo(srpSale.id,$event,srpSale.objectId)" class="btn-edit">编辑</a>
				</td>
			</tr>
		</table>
	</div>
	<div class="content-box margin-bottom-20">
		<h3 class="detail-header border-all border-bottom-none">回款指标信息</h3>
		<table class="detail-table">
			<tr class="bg-gray">
				<th class="column1">月份</th>
				<th class="column2">计划回款额</th>
				<th class="column3">汇总实际回款额</th>
				<th class="column4">差额</th>
				<th class="column5">偏差原因</th>
				<th class="column6">操作</th>
			</tr>
			<tr v-for="srpReturn in row.returnList">
				<td class="column1">{{srpReturn.saleMonth}}月</td>
                <td class="column2 table-number">{{srpReturn.salePlan}}</td>
                <td class="column3 table-number">{{srpReturn.saleActual}}</td>
                <td class="column4 table-number">{{srpReturn.saleDiff}}</td>
                <td class="column5">{{srpReturn.saleDiffReason}}</td>
				<td class="column6">
				  	<a href="#" v-on:click="dynamiSalesInfo(srpReturn.id,$event,srpReturn.objectId)" class="btn-edit">编辑</a>
				</td>
			</tr>
			
		</table>
	</div>
	<div class="content-box margin-bottom-20 border-all">
		<h3 class="detail-header border-bottom">业态销售数据汇总</h3>
		<table class="detail-content sale-data">
			<tr>
				<td>
					<div class="td-title fl">总户数：</div>
					<div class="td-content fl">{{row.staticSalesData.totalHouse}}</div>
				</td>
				<td>
					<div class="td-title fl">栋数：</div>
					<div class="td-content fl">{{row.staticSalesData.numberOfBuildi}}</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="td-title fl">可售面积：</div>
					<div class="td-content fl">{{row.staticSalesData.salableAcreag}}</div>
				</td>
				<td>
					<div class="td-title fl">可售套数(套)：</div>
					<div class="td-content fl">{{row.staticSalesData.salableNumber}}</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="td-title fl">自持面积(万m2)：</div>
					<div class="td-content fl">{{row.staticSalesData.selfSustaiAcreag}}</div>
				</td>
				
			</tr>
			<tr>
				<td>
					<div class="td-title fl">地上可售面积(万m2)：</div>
					<div class="td-content fl">{{row.staticSalesData.groundSalesAcreag}}</div>
				</td>
				<td>
					<div class="td-title fl">地下可售面积(万m2)：</div>
					<div class="td-content fl">{{row.staticSalesData.undergSalesAcreag}}</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="td-title fl">可售车位数：</div>
					<div class="td-content fl">{{row.staticSalesData.numberOfParkinSpace}}</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="td-title fl">地上机动车位(个)：</div>
					<div class="td-content fl">{{row.staticSalesData.groundVechicParkinSpace}}</div>
				</td>
				<td>
					<div class="td-title fl">地下机动车位(个)：</div>
					<div class="td-content fl">{{row.staticSalesData.undergVechicParkinSpace}}</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="td-title fl">地上非机动车位(个)：</div>
					<div class="td-content fl">{{row.staticSalesData.groundNonVechicParkinSpace}}</div>
				</td>
				<td>
					<div class="td-title fl">地下非机动车位(个)：</div>
					<div class="td-content fl">{{row.staticSalesData.undergNonVechicParkinSpace}}</div>
				</td>
			</tr>
		</table>
		<h3 class="detail-header border-top border-bottom">动态销售数据汇总</h3>
		<table class="detail-content sale-data">
			
			<tr>
                <td>
                    <div class="td-title fl">目标货值：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.targetValue}}</div>
                </td>
                <td>
                    <div class="td-title fl">动态货值：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.dynamiValue}}</div>
                </td>
            </tr>
            
            
             <tr>
                <td>
                    <div class="td-title fl">已售面积：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.soldAcreag}}</div>
                </td>
                <td>
                    <div class="td-title fl">未售面积：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.unsoldArea}}</div>
                </td>
            </tr>
            
            
            <tr>
                <td>
                    <div class="td-title fl">未来销售最低均价：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.lowestAveragPriceInFuture}}</div>
                </td>
                <td>
                    <div class="td-title fl">动态均价：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.dynamiAveragPrice}}</div>
                </td>
            </tr>
            <tr>
            	<td>
            		   <div class="td-title fl">差额：</div>
            		   <div class="td-content fl" v-if="row.levelDynamiSalesData.difference!=0">{{row.levelDynamiSalesData.difference}}</div>
            	</td>
            </tr>
            
            
               <tr>
                <td>
                    <div class="td-title fl">车位目标货值：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.cwTargetValue}}</div>
                </td>
                <td>
                    <div class="td-title fl">车位动态货值：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.cwDynamiValue}}</div>
                </td>
            </tr>
             <tr>
                <td>
                    <div class="td-title fl">已售车位数：</div>
                    <div class="td-content fl" v-if="row.levelDynamiSalesData.soldParkinSpace!=0">{{row.levelDynamiSalesData.soldParkinSpace}}</div>
                </td>
                <td>
                    <div class="td-title fl">未售车位数：</div>
                    <div class="td-content fl" v-if="row.levelDynamiSalesData.cwUnsoldParkinSpace!=0">{{row.levelDynamiSalesData.cwUnsoldParkinSpace}}</div>
                </td>
            </tr>
            
            <tr>
                <td>
                    <div class="td-title fl">车位未来销售最低均价：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.cwLowestAveragPriceInFuture}}</div>
                </td>
                <td>
                    <div class="td-title fl">车位动态均价：</div>
                    <div class="td-content fl">{{row.levelDynamiSalesData.averagPriceOfParkinSpace}}</div>
                </td>
            </tr>
             <tr>
            	<td>
            		   <div class="td-title fl">差额：</div>
            		   <div class="td-content fl" v-if="row.levelDynamiSalesData.cwDifference!=0">{{row.levelDynamiSalesData.cwDifference}}</div>
            	</td>
            </tr>
			
		</table>
		
	</div>
	<div class="content-box border-all">
		<!-- 业态数据 -->
		<div v-for="preIndust in row.staticSalesIndustDatas">
			<h3 class="detail-header border-bottom">业态销售数据 
			<c:if test="${ not empty premisesId}">
			<a  style="text-decoration: none;" onclick="createIndustModel(this,'${id}','${premisesId}',null,false,1)" v-bind:id="preIndust.id">编辑业态</a>
			<a  style="text-decoration: none;" v-bind:id="preIndust.id" onclick="deleteIndust(this,false)">删除业态</a>
			</c:if>
			
			</h3>
			<table class="detail-content sale-data">
				
				<tbody v-if="preIndust.industKey!='车位'"> 
				<tr>
					<td>
						<div class="td-title fl">大业态类型：</div>
						<div class="td-content fl">{{preIndust.industValue}}</div>
					</td>
					<td>
						<div class="td-title fl">小业态类型：</div>
						<div class="td-content fl">{{preIndust.industKey}}</div>
					</td>
				</tr>
					<tr>
					<td>
	                    <div class="td-title fl">总户数：</div>
	                    <div class="td-content fl">{{preIndust.industData.totalHouse}}</div>
	                </td>
	                <td>
	                    <div class="td-title fl">栋数：</div>
	                    <div class="td-content fl">{{preIndust.industData.numberOfBuildi}}</div>
	                </td>
	            	</tr>
		            <tr >
		                <td>
		                    <div class="td-title fl">可售面积(万m2)：</div>
		                    <div class="td-content fl">{{preIndust.industData.salableAcreag}}</div>
		                </td>
		                <td>
		                    <div class="td-title fl">可售套数(套)：</div>
		                    <div class="td-content fl">{{preIndust.industData.numberLayers}}</div>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <div class="td-title fl">自持面积(万m2)：</div>
		                    <div class="td-content fl">{{preIndust.industData.selfSustaiAcreag}}</div>
		                </td>
		                <td>
		                    <div class="td-title fl">自持货值：</div>
		                    <div class="td-content fl">{{preIndust.industData.targetValue}}</div>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <div class="td-title fl">地上可售面积(万m2)：</div>
		                    <div class="td-content fl">{{preIndust.industData.groundSalesAcreag}}</div>
		                </td>
		               
			         <td>
	                    <div class="td-title fl">地下可售面积(万m2)：</div>
	                    <div class="td-content fl">{{preIndust.industData.undergSalesAcreag}}</div>
	                </td>
		            </tr>
		            
		             <tr>
		             <td>
		                    <div class="td-title fl">目标销售均价：</div>
		                    <div class="td-content fl">{{preIndust.industData.targetAveragPrice}}</div>
		                </td>
		                <td>
		                    <div class="td-title fl">版本：</div>
		                    <div class="td-content fl">{{preIndust.industData.targetVersionName}}</div>
		                </td>
		            </tr>
		            
				</tbody>
				<tbody v-if="preIndust.industKey=='车位'">
					<tr>
						<td>
							<div class="td-title fl">大业态类型：</div>
							<div class="td-content fl">{{preIndust.industValue}}</div>
						</td>
						<td>
							<div class="td-title fl">小业态类型：</div>
							<div class="td-content fl">{{preIndust.industKey}}</div>
						</td>
					</tr>
	        	 	<tr >
	                <td>
	                    <div class="td-title fl">可售车位数(个)：</div>
	                    <div class="td-content fl">{{preIndust.industData.numberOfParkinSpace}}</div>
	                </td>
	                
	                  <td>
	                    <div class="td-title fl">自持货值：</div>
	                    <div class="td-content fl">{{preIndust.industData.targetValue}}</div>
	                </td>
	                </tr>
	                <tr>
		             <td>
		                    <div class="td-title fl">目标销售均价：</div>
		                    <div class="td-content fl">{{preIndust.industData.targetAveragPrice}}</div>
		                </td>
		                <td>
		                    <div class="td-title fl">版本：</div>
		                    <div class="td-content fl">{{preIndust.industData.targetVersionName}}</div>
		                </td>
		            </tr>
        		</tbody>
			</table>
		</div>
		
		<!-- 项目下各个分期的业态动态销售数据 -->
		<div v-for="dynamisale in row.dynamiExtend">
			<h3 class="detail-header border-top border-bottom">动态销售数据</h3>
			<table class="detail-content sale-data">
				<tr>
					<td>
						<div class="td-title fl">大业态类型：</div>
						<div class="td-content fl">{{dynamisale.industKey}}</div>
					</td>
					<td>
						<div class="td-title fl">小业态类型：</div>
						<div class="td-content fl">{{dynamisale.industValue}}</div>
					</td>
				</tr>
				
				<tbody v-if="dynamisale.industValue!='车位'">
         		   <tr>
                <td>
                    <div class="td-title fl">已售面积：</div>
                    <div class="td-content fl">{{dynamisale.soldAcreag}}</div>
                </td>
                <td>
                    <div class="td-title fl">未售面积：</div>
                    <div class="td-content fl">{{dynamisale.totalNoCalculateArea}}</div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="td-title fl">实际销售额：</div>
                    <div class="td-content fl">{{dynamisale.monthActualSalesAmount}}</div>
                </td>
                <td>
                    <div class="td-title fl">实际回款额：</div>
                    <div class="td-content fl">{{dynamisale.monthActualBackAmount}}</div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="td-title fl">动态货值：</div>
                    <div class="td-content fl">{{dynamisale.dynamiValue}}</div>
                </td>
                <td>
                    <div class="td-title fl">动态均价：</div>
                    <div class="td-content fl">{{dynamisale.dynamiAveragPrice}}</div>
                </td>
            </tr>
            <tr>
            	 <td>
                    <div class="td-title fl">目标货值：</div>
                    <div class="td-content fl">{{dynamisale.targetValue}}</div>
                </td>
                <td>
                    <div class="td-title fl">未来销售最低均价：</div>
                    <div class="td-content fl">{{dynamisale.lowestAveragPriceInFuture}}</div>
                </td>
            </tr>
          
         
            <tr>
            
            	 <td>
                    <div class="td-title fl">差额(万元)：</div>
                    <div class="td-content fl" v-if="dynamisale.difference!=0">{{dynamisale.difference}}</div>
                </td>
                <td >
                    <div class="td-title fl">偏差原因：</div>
                    <div class="td-content fl">{{dynamisale.deviationRemake}}</div>
                </td>
            </tr> 
         	</tbody >
				
				
				<tbody v-if="dynamisale.industValue=='车位'">
         		<tr>
         			<td>
                    <div class="td-title fl">已售车位数(个)：</div>
                    <div class="td-content fl" v-if="dynamisale.soldParkinSpace!=0">{{dynamisale.soldParkinSpace}}</div>
                	</td>
                	
                	<td>
                    <div class="td-title fl">未售车位数(个)：</div>
                    <div class="td-content fl" v-if="dynamisale.totalNoCalculateArea!=0">{{dynamisale.totalNoCalculateArea}}</div>
                	</td>
                	
         		</tr>
         		  <tr>
                <td>
                    <div class="td-title fl">实际销售额(万元)：</div>
                    <div class="td-content fl">{{dynamisale.monthActualSalesAmount}}</div>
                </td>
                <td>
                    <div class="td-title fl">实际回款额(万元)：</div>
                    <div class="td-content fl">{{dynamisale.monthActualBackAmount}}</div>
                </td>
           	 </tr>
           	 
           	  <tr>
                <td>
                    <div class="td-title fl">车位动态货值(万元)：</div>
                    <div class="td-content fl">{{dynamisale.cwDynamiAveragPrice}}</div>
                </td>
                <td>
                    <div class="td-title fl">车位动态均价(万元)：</div>
                    <div class="td-content fl">{{dynamisale.averagPriceOfParkinSpace}}</div>
                </td>
           	 </tr>
           	 
           	 
           	  <tr>
                <td>
                    <div class="td-title fl">车位目标货值(万元)：</div>
                    <div class="td-content fl">{{dynamisale.targetValue}}</div>
                </td>
                <td>
                    <div class="td-title fl">车位未来销售最低均价：</div>
                    <div class="td-content fl">{{dynamisale.lowestAveragPriceInFuture}}</div>
                </td>
           	 </tr>
         		<tr>
            	<td>
                    <div class="td-title fl">差额(万元)：</div>
                    <div class="td-content fl" v-if="dynamisale.cwDifference!=0">{{dynamisale.cwDifference}}</div>
                </td>
                <td >
                    <div class="td-title fl">偏差原因：</div>
                    <div class="td-content fl">
                    	{{dynamisale.deviationRemake}}
                    </div>
                </td>
            	</tr>
         		<tr>
         			<td></td>
         		</tr>
         	</tbody>
				
				
				<tr>
					<td></td>
				</tr>
				
			</table>
		</div>
		
	</div>
</div>
</div>
<div id="editPlan" style="display: none;">
	<table style="margin-top: 30px;">
		<tr>
			<td style="width: 20%"></td>
			<td style="width: 80%"><textarea id="saleDiffReason"   style="width: 200px;height: 100;" ></textarea></td>
		</tr>
	</table>
</div>
<script type="text/javascript">
var stageBrowse = new Vue({
	el:"#stageBrowse_div",
	data:{
		projectId:'${id}',
		levelData:[]
		
	},mounted:function(){
		this.projectPremisesData();
	},methods: {
		projectPremisesData: function() {
			var loadIndex = layer.load(0, {shade: false});
			var _self = this;
	    	var params={
	    			id: _self.projectId,
	    			premisesId:'${premisesId}'	
	    		};
	    	var apiUrl = "${pageContext.request.contextPath}/estate/project/projectPremisesData";
	    	$.ajax({
	    		  type: "POST",
		          url: apiUrl,
		          data: params,
		          dataType: "json",
		          success: function(data){
		        	 _self.levelData = data;
		        	 layer.close(loadIndex);
		          }
	    	});
		},
		dynamiSalesInfo:function(id,e,premisesId){
			var _self = this;
			JY.Model.edit("editPlan",'偏差原因',function(){
				var saleDiffReason = $("#saleDiffReason").val();
				if(null==saleDiffReason||saleDiffReason==""){
					layer.alert("请填写原因");
				}else{
					var params = {
							id:id,
							saleDiffReason:$("#saleDiffReason").val()
					};
					$("#editPlan").dialog("close");
					var url = '${pageContext.request.contextPath}/estate/project/editSalesReturnPlant';
					$.ajax({
						  type: "POST",
				          url: url,
				          data: params,
				          dataType: "json",
				          success: function(data){
				        	  _self.querySalePlan(premisesId);
				        	  layer.alert(data.resMsg);
				          }
					});
				}
			});
		}
		
	}
});
</script>
